home *** CD-ROM | disk | FTP | other *** search
/ PC User 2002 April / Disc 2 / PCUSER0402D2.iso / software / utils / files / wincron.exe / data1.cab / Sample_Scripts / ftp_get.tg < prev    next >
Encoding:
Text File  |  2001-10-20  |  1.3 KB  |  43 lines

  1. ## ftp_get.tg
  2. # file Get
  3. # script assumes:
  4. # 1. There is a temp/foo/test_file.dat file on the remote server.
  5. # 2. There is a c:\temp\foo local directory.
  6. # 3. the environment variables: USER.SERVER, USER.USERID, and USER.PASSWORD are set elsewhere,
  7. #    perhaps in the global (computer) environment or the local environment of WinCron via 
  8. #    Config.tg or AutoRun.tg. You could also set them here in this this script or hard-code the 
  9. #    values passed to -ftp connect.
  10.  
  11. # get a file
  12. {
  13.     -name ftp_get
  14.     -start 
  15.     -stop
  16.     -action -print connecting to remote ftp server
  17.     -action -onerror connect_fail
  18.     -action -ftp connect handle %USER.SERVER% 21 %USER.USERID% %USER.PASSWORD%
  19.     -action -print getting file from remote ftp server
  20.     -action -onerror operation_fail
  21.     -action -ftp get handle temp/foo/test_file.dat c:\temp\foo\test_file.dat 0
  22.     -action -ftp close handle 
  23.     -action -print done!
  24. }
  25.  
  26. # connection failed
  27. {
  28.     -name connect_fail
  29.     -action -print FTP open connection failed with error:
  30.     -action -print %TG.LAST_ERROR%
  31.     -action -return abort
  32. }
  33.  
  34. # operation failed
  35. {
  36.     -name operation_fail
  37.     -action -print FTP get failed with error:
  38.     -action -print %TG.LAST_ERROR%
  39.     -action -print Closing connection.
  40.     -action -ftp close handle
  41.     -action -return abort
  42. }
  43.